﻿using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HumanResource2.Views
{
    /// <summary>
    /// Interaction logic for HumanResource2View.xaml
    /// </summary>
    public partial class HumanResource2View : UserControl
    {
      ServiceReference1.Container context=new ServiceReference1.Container(new Uri("http://localhost:1179/odata"));

        private readonly IUnityContainer container;
        private readonly IRegionManager rManager;


        public HumanResource2View(IUnityContainer c, IRegionManager r)
        {
            InitializeComponent();

            container = c;
            rManager = r;

            this.membersListView.ItemsSource = (IEnumerable)context.Members;

            

        }

        private void Radiobutton_Click(object sender, RoutedEventArgs e)
        {
            Uri viewNav = new Uri("Product_1_View", UriKind.Relative);
            rManager.RequestNavigate(RegionNames.MainContentRegion, viewNav);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {

            this.AdminListView.ItemsSource = (IEnumerable)from kkk in context.Members
                                                         where kkk.Mem_Id == this.membersListView.SelectedIndex +1
                                                         select new
                                                         {
                                                             Mem_Name = kkk.Mem_Name,
                                                             Mem_Tel = kkk.Mem_Tel
                                                         };

        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            this.nodongListView.ItemsSource = (IEnumerable)from kkk in context.Members
                                                          where kkk.Mem_Id == this.membersListView.SelectedIndex +1
                                                          select new
                                                          {
                                                              Mem_Name = kkk.Mem_Name,
                                                              Mem_Tel = kkk.Mem_Tel
                                                          };
        }
    }
}
